package com.future.mayi.activity;

import android.content.Intent;
import android.text.TextUtils;
import android.view.View;
import android.widget.TextView;

import com.future.mayi.R;

import butterknife.BindView;
import butterknife.OnClick;

public class PaySuccessActivity extends BaseTitleActivity {
    @BindView(R.id.tv_back)
    TextView tvBack;
    @BindView(R.id.tv_enter)
    TextView tvEnter;

    private String orderId;

    @Override
    protected void initTopBar() {
        initBack();
        getTitleText().setText("支付成功");
    }

    @Override
    protected void initLayout() {
        setContentView(R.layout.activity_pay_success);
    }

    @Override
    protected void initView() {

    }

    @Override
    protected void initDates() {
        orderId = getIntent().getStringExtra("orderId");


    }

    @Override
    protected void initListener() {

    }


    @OnClick({R.id.tv_back, R.id.tv_enter})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.tv_back:
                onBackPressed();
                break;
            case R.id.tv_enter:
                if (TextUtils.isEmpty(orderId) || TextUtils.equals(orderId, "0")) {
                    GoodsAllOrderActivity.startActivity(mContext,0,true);
                } else {
                    GoodsOrderActivity.startActivity(this, orderId, true);
                }
                finish();
                break;
        }
    }

    @Override
    public void onBackPressed() {
        Intent intent = new Intent(this, MainActivity.class);
        intent.putExtra("intentToIndexFragment", true);
        intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
        startActivity(intent);
    }
}
